#!/bin/bash

set -e

if [[ -n "${GT_CHATTA_DEBUG}" ]]; then
    set -x
fi

DIR="$(dirname "$0")"

function usage() {
    echo -n \
"Usage: $(basename "$0")
Starts docker-compose service
"
}

if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
    if [ "${1:-}" = "--help" ]; then
        usage
    else
		if [ "${1:-}" = "--geodocker" ]
	    then
	        docker-compose -f "${DIR}/../docker-compose.geodocker.yml" run --rm \
	        	--service-ports spark-master ./sbt "runMain geotrellis.chatta.Main"
	    else
	        docker-compose up gt-chatta
	    fi
    fi
fi
